 chrome.browserAction.onClicked.addListener(function(tab) {
     var chromeExtURL = "chrome://downloads/";
     chrome.tabs.getAllInWindow(null, function(tabs) {
         for (var i = 0; i < tabs.length; i++) {
             if (tabs[i].url == chromeExtURL) {
                 chrome.tabs.update(tabs[i].id, { selected: true })
                 return;
             }
         }

     })
     /*chrome.tabs.getCurrent(function(tab) {
         alert(tab.url);
     });*/
     console.log(tab.url)
     var domain = tab.url.split('/');
     if (domain[2]) {
         domain = domain[2];
         window.open("https://www.ipaddress.com/search/" + domain);
     }
     /*chrome.windows.get(tab.windowId, null, function(win) {
         console.log(win)

     });*/

     //window.open("https://www.ipaddress.com/search/www.oschina.net");
 })